<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>智慧社区管理系统 - 房产管理</title>
    <!-- 引入 FontAwesome 图标库 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
    <!-- 引入 Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        /* 移动端表格样式 */
        .table-responsive {
            overflow-x: auto;
            padding: 0 10px;
            margin: 0 -10px;
        }

        @media (max-width: 768px) {
            .mobile-row {
                display: block;
                margin-bottom: 15px;
                border: 1px solid #dee2e6;
            }

            .mobile-row td {
                display: flex;
                justify-content: space-between;
                padding: 8px 12px;
            }

            .mobile-row td:before {
                content: attr(data-label);
                font-weight: bold;
                margin-right: 10px;
            }

            .mobile-row td:first-child {
                display: none;
            }
        }

        /* 表格行悬停动画 */
        .table-hover tbody tr {
            transition: all 0.2s ease;
        }

        .table-hover tbody tr:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
        }

        /* 按钮加载状态 */
        .btn-loading {
            position: relative;
            pointer-events: none;
        }

        .btn-loading:after {
            content: '';
            position: absolute;
            width: 16px;
            height: 16px;
            top: 50%;
            left: 50%;
            margin-top: -8px;
            margin-left: -8px;
            border: 2px solid rgba(255, 255, 255, 0.5);
            border-radius: 50%;
            border-top-color: white;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }

        :root {
            --primary-color: #3498db;
            --secondary-color: #2980b9;
            --success-color: #2ecc71;
            --warning-color: #f39c12;
            --danger-color: #e74c3c;
            --light-color: #ecf0f1;
            --dark-color: #34495e;
            --text-color: #333;
            --border-color: #ddd;
            --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            --transition: all 0.3s ease;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 'Noto Sans SC', Arial, sans-serif;
            line-height: 1.6;
            color: var(--text-color);
            background-color: #f5f7fa;
        }

        .container {
            width: 100%;
            max-width: 1400px;
            margin: 0 auto;
            padding: 15px;
        }

        @media (min-width: 1200px) {
            .container {
                padding: 25px 40px;
            }
        }

        /* 头部样式 */
        .header {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            padding: 25px 0;
            text-align: center;
            box-shadow: var(--shadow);
            position: relative;
            z-index: 100;
            border-bottom: 3px solid rgba(255, 255, 255, 0.2);
        }

        .header h1 {
            font-weight: 500;
            margin: 0;
            font-size: 2.2rem;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
        }

        @media (max-width: 768px) {
            .header h1 {
                font-size: 1.8rem;
            }
        }

        @media (max-width: 576px) {
            .header h1 {
                font-size: 1.5rem;
            }
        }

        /* 导航栏样式 */
        .nav {
            background-color: white;
            padding: 0;
            box-shadow: var(--shadow);
            position: sticky;
            top: 0;
            z-index: 99;
            border-bottom: 2px solid var(--primary-color);
        }

        .nav ul {
            list-style-type: none;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
        }

        .nav ul li {
            position: relative;
        }

        .nav ul li a {
            text-decoration: none;
            color: var(--dark-color);
            padding: 15px 20px;
            display: block;
            font-weight: 500;
            transition: var(--transition);
            font-size: 0.95rem;
        }

        @media (min-width: 992px) {
            .nav ul li a {
                padding: 20px 30px;
                font-size: 1rem;
            }
        }

        .nav ul li a:hover,
        .nav ul li a.active {
            color: var(--primary-color);
            background-color: rgba(52, 152, 219, 0.1);
        }

        .nav ul li a.active:after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 3px;
            background-color: var(--primary-color);
        }

        /* 主内容区样式 */
        .main-content {
            display: flex;
            flex-wrap: wrap;
            margin-top: 20px;
            gap: 20px;
        }

        @media (max-width: 768px) {
            .main-content {
                flex-direction: column;
            }
        }

        .sidebar {
            width: 260px;
            flex-shrink: 0;
            background-color: white;
            border-radius: 8px;
            box-shadow: var(--shadow);
            padding: 20px;
            margin-right: 25px;
            height: fit-content;
            border: 1px solid var(--border-color);
        }

        @media (max-width: 992px) {
            .sidebar {
                width: 220px;
                margin-right: 15px;
                padding: 15px;
            }
        }

        .sidebar h3 {
            color: var(--dark-color);
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 2px solid var(--border-color);
        }

        .sidebar-menu {
            list-style: none;
        }

        .sidebar-menu li {
            margin-bottom: 10px;
        }

        .sidebar-menu a {
            display: block;
            padding: 12px;
            color: var(--text-color);
            text-decoration: none;
            border-radius: 4px;
            transition: var(--transition);
        }

        .sidebar-menu a:hover,
        .sidebar-menu a.active {
            background-color: rgba(52, 152, 219, 0.1);
            color: var(--primary-color);
        }

        .sidebar-menu i {
            margin-right: 12px;
            width: 20px;
            text-align: center;
        }

        .content {
            flex: 1;
        }

        /* 卡片样式 */
        .card {
            background-color: white;
            border-radius: 8px;
            box-shadow: var(--shadow);
            padding: 20px;
            margin-bottom: 20px;
            border: 1px solid var(--border-color);
        }

        @media (min-width: 768px) {
            .card {
                padding: 25px;
                margin-bottom: 25px;
            }
        }

        .card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            padding-bottom: 15px;
            border-bottom: 2px solid var(--border-color);
        }

        .card-header h2 {
            color: var(--dark-color);
            font-size: 1.6rem;
            margin: 0;
        }

        @media (max-width: 768px) {
            .card-header h2 {
                font-size: 1.4rem;
            }
        }

        @media (max-width: 576px) {
            .card-header h2 {
                font-size: 1.2rem;
            }
        }

        /* 表单样式 */
        .form-group {
            margin-bottom: 25px;
        }

        .form-group label {
            display: block;
            margin-bottom: 10px;
            font-weight: 500;
            color: var(--dark-color);
        }

        .form-control {
            width: 100%;
            padding: 12px 18px;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            font-size: 1rem;
            transition: var(--transition);
        }

        .form-control.border-danger {
            border-color: var(--danger-color);
            animation: shake 0.5s;
        }

        @keyframes shake {

            0%,
            100% {
                transform: translateX(0);
            }

            25% {
                transform: translateX(-5px);
            }

            75% {
                transform: translateX(5px);
            }
        }

        .form-control:focus {
            border-color: var(--primary-color);
            outline: none;
            box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
        }

        textarea.form-control {
            min-height: 150px;
            resize: vertical;
        }

        select.form-control {
            appearance: none;
            background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
            background-repeat: no-repeat;
            background-position: right 15px center;
            background-size: 1em;
        }

        /* 按钮样式 */
        .btn {
            display: inline-block;
            padding: 12px 25px;
            border: none;
            border-radius: 4px;
            font-size: 1rem;
            font-weight: 500;
            cursor: pointer;
            transition: var(--transition);
            text-align: center;
        }

        .btn-primary {
            background-color: var(--primary-color);
            color: white;
            position: relative;
            overflow: hidden;
        }

        .btn-primary:after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 150%;
            height: 150%;
            background: rgba(255, 255, 255, 0.1);
            transform: translate(-50%, -50%) scale(0);
            transition: transform 0.3s ease;
        }

        .btn-primary:hover:after {
            transform: translate(-50%, -50%) scale(1);
        }

        .btn-primary:hover {
            background-color: var(--secondary-color);
        }

        .btn-success {
            background-color: var(--success-color);
            color: white;
        }

        .btn-success:hover {
            background-color: #27ae60;
        }

        .btn-warning {
            background-color: var(--warning-color);
            color: white;
        }

        .btn-warning:hover {
            background-color: #e67e22;
        }

        .btn-danger {
            background-color: var(--danger-color);
            color: white;
        }

        .btn-danger:hover {
            background-color: #c0392b;
        }

        .btn-outline {
            background-color: transparent;
            border: 1px solid var(--border-color);
            color: var(--text-color);
        }

        .btn-outline:hover {
            background-color: var(--light-color);
        }

        .btn-sm {
            padding: 6px 12px;
            font-size: 13px;
        }

        .btn-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .btn-icon i {
            margin-right: 8px;
        }

        /* 表格样式 */
        .table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 25px;
            table-layout: fixed;
        }

        @media (max-width: 768px) {
            .table {
                table-layout: auto;
            }
        }

        .table th,
        .table td {
            padding: 15px 20px;
            text-align: center;
            border-bottom: 1px solid var(--border-color);
        }

        @media (max-width: 576px) {
            .table th,
            .table td {
                padding: 10px 8px;
            }
        }

        .table th {
            background-color: var(--light-color);
            color: var(--dark-color);
            font-weight: 500;
            text-align: center;
        }

        .table th:after {
            content: '';
            display: inline-block;
            width: 100%;
        }

        /* 表格列宽设置 */
        .table th:nth-child(1),
        .table td:nth-child(1) {
            width: 8%;
        }

        .table th:nth-child(2),
        .table td:nth-child(2) {
            width: 8%;
        }

        .table th:nth-child(3),
        .table td:nth-child(3) {
            width: 8%;
        }

        .table th:nth-child(4),
        .table td:nth-child(4) {
            width: 10%;
        }

        .table th:nth-child(5),
        .table td:nth-child(5) {
            width: 10%;
        }

        .table th:nth-child(6),
        .table td:nth-child(6) {
            width: 10%;
        }

        .table th:nth-child(7),
        .table td:nth-child(7) {
            width: 10%;
        }

        .table th:nth-child(8),
        .table td:nth-child(8) {
            width: 10%;
        }

        .table th:nth-child(9),
        .table td:nth-child(9) {
            width: 8%;
        }

        .table th:nth-child(10),
        .table td:nth-child(10) {
            width: 18%;
        }

        @media (max-width: 576px) {
            .table th:nth-child(10),
            .table td:nth-child(10) {
                min-width: 180px;
            }
        }

        @media (max-width: 360px) {
            .table th:nth-child(10),
            .table td:nth-child(10) {
                min-width: 150px;
            }

            .action-btn span {
                font-size: 10px;
            }
        }

        /* 特定列文本对齐 */
        .table th:nth-child(7),
        .table td:nth-child(7),
        .table th:nth-child(8),
        .table td:nth-child(8) {
            text-align: center;
        }

        .table tr:hover {
            background-color: rgba(52, 152, 219, 0.05);
            transform: translateX(5px);
            transition: transform 0.3s ease;
        }

        .table .actions {
            white-space: nowrap;
        }

        @media (max-width: 480px) {
            .table .actions {
                flex-direction: column;
                align-items: center;
                gap: 3px;
                padding: 3px 0;
            }

            .action-btn {
                width: 100%;
                justify-content: center;
            }
        }

        @media (max-width: 768px) {
            .table .actions {
                white-space: normal;
                display: flex;
                flex-wrap: wrap;
                gap: 5px;
                justify-content: center;
                padding: 5px 0;
            }

            .table th:nth-child(9),
            .table td:nth-child(9) {
                width: 5%;
            }

            .table th:nth-child(10),
            .table td:nth-child(10) {
                width: 18%;
                min-width: 110px;
            }
        }

        /* 状态标签 */
        .badge {
            display: inline-block;
            padding: 6px 10px;
            border-radius: 4px;
            font-size: 0.8rem;
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        @media (max-width: 576px) {
            .badge {
                padding: 4px 8px;
                font-size: 0.75rem;
            }
        }

        .badge-primary {
            background-color: rgba(52, 152, 219, 0.1);
            color: var(--primary-color);
        }

        .badge-success {
            background-color: rgba(46, 204, 113, 0.1);
            color: var(--success-color);
        }

        .badge-warning {
            background-color: rgba(243, 156, 18, 0.1);
            color: var(--warning-color);
        }

        .badge-danger {
            background-color: rgba(231, 76, 60, 0.1);
            color: var(--danger-color);
        }

        /* 仪表盘统计卡片 */
        .stats-container {
            display: flex;
            justify-content: space-between;
            gap: 15px;
            margin-bottom: 25px;
            flex-wrap: wrap;
        }

        @media (max-width: 576px) {
            .stats-container {
                flex-direction: column;
            }

            .stat-card {
                width: 100%;
            }
        }

        .stat-card {
            background-color: white;
            border-radius: 8px;
            box-shadow: var(--shadow);
            padding: 25px;
            display: flex;
            align-items: center;
            border: 1px solid var(--border-color);
            flex: 1;
            min-width: 0;
        }

        .stat-icon {
            width: 70px;
            height: 70px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 20px;
            font-size: 1.8rem;
            color: white;
        }

        .stat-icon.primary {
            background-color: var(--primary-color);
        }

        .stat-icon.success {
            background-color: var(--success-color);
        }

        .stat-icon.warning {
            background-color: var(--warning-color);
        }

        .stat-icon.danger {
            background-color: var(--danger-color);
        }

        .action-btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px;
            border-radius: 4px;
            transition: all 0.2s ease;
        }

        @media (max-width: 576px) {
            .action-btn {
                padding: 6px 10px;
                gap: 5px;
            }

            .action-btn span {
                font-size: 12px;
            }

            .action-btn i {
                font-size: 12px;
            }
        }

        .action-btn i {
            font-size: 14px;
        }

        .action-btn span {
            font-size: 14px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100px;
        }

        @media (max-width: 576px) {
            .action-btn {
                padding: 5px 8px;
            }

            .action-btn span {
                font-size: 11px;
            }
        }

        .action-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        .stat-info h3 {
            font-size: 2rem;
            margin: 0;
            color: var(--dark-color);
        }

        @media (max-width: 768px) {
            .stat-info h3 {
                font-size: 1.7rem;
            }
        }

        @media (max-width: 576px) {
            .stat-info h3 {
                font-size: 1.5rem;
            }
        }

        .stat-info p {
            margin: 8px 0 0;
            color: #777;
        }

        /* 移动端模拟 */
        .mobile-preview {
            width: 320px;
            border: 12px solid #222;
            border-radius: 30px;
            padding: 15px;
            background-color: #f5f5f5;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
            margin: 0 auto;
        }

        .mobile-header {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            padding: 15px;
            border-radius: 10px 10px 0 0;
            text-align: center;
            margin-bottom: 15px;
        }

        .mobile-nav {
            display: flex;
            justify-content: space-around;
            padding: 10px 0;
            background-color: white;
            border-radius: 0 0 10px 10px;
            box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
        }

        .mobile-nav-item {
            text-align: center;
            color: #777;
            font-size: 0.8rem;
        }

        .mobile-nav-item.active {
            color: var(--primary-color);
        }

        .mobile-nav-item i {
            display: block;
            font-size: 1.2rem;
            margin-bottom: 5px;
        }

        /* 响应式设计 */
        @media (max-width: 992px) {
            .main-content {
                flex-direction: column;
            }

            .sidebar {
                width: 100%;
                margin-right: 0;
                margin-bottom: 25px;
            }

            .nav ul {
                flex-wrap: wrap;
            }

            .nav ul li {
                margin-bottom: 8px;
            }
        }

        @media (max-width: 768px) {
            .stats-container {
                grid-template-columns: 1fr 1fr;
            }

            .mobile-preview {
                width: 280px;
            }
        }

        @media (max-width: 576px) {
            .stats-container {
                grid-template-columns: 1fr;
            }

            .nav ul li a {
                padding: 12px 18px;
                font-size: 0.9rem;
            }
        }

        /* 动画效果 */
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .animate-fade {
            animation: fadeIn 0.5s ease forwards;
        }

        /* 选项卡样式 */
        .tabs {
            display: flex;
            border-bottom: 1px solid var(--border-color);
            margin-bottom: 25px;
        }

        .tab {
            padding: 12px 25px;
            cursor: pointer;
            border-bottom: 3px solid transparent;
            transition: var(--transition);
        }

        .tab:hover {
            color: var(--primary-color);
        }

        .tab.active {
            color: var(--primary-color);
            border-bottom-color: var(--primary-color);
            font-weight: 500;
        }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        /* 新增：批量操作下拉菜单样式 */
        .dropdown {
            position: relative;
            display: inline-block;
        }

        .dropdown-content {
            display: none;
            position: absolute;
            background-color: #f9f9f9;
            min-width: 160px;
            box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
            z-index: 1;
        }

        .dropdown-content a {
            color: black;
            padding: 12px 16px;
            text-decoration: none;
            display: block;
        }

        .dropdown-content a:hover {
            background-color: #f1f1f1;
        }

        .dropdown:hover .dropdown-content {
            display: block;
        }

        /* 模态框样式 */
        .modal {
            display: none;
            /* 默认隐藏 */
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0, 0, 0, 0.4);
        }

        .modal-dialog {
            margin: 10% auto;
            width: 80%;
            max-width: 600px;
        }

        .modal-content {
            background-color: #fefefe;
            padding: 20px;
            border: 1px solid #888;
            border-radius: 8px;
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #ddd;
            padding-bottom: 10px;
            margin-bottom: 20px;
        }

        .modal-footer {
            display: flex;
            justify-content: flex-end;
            border-top: 1px solid #ddd;
            padding-top: 20px;
            margin-top: 20px;
        }

        /* 新增：编辑模态框两列布局 */
        .edit-form-columns {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
        }

        .edit-form-columns .form-group {
            width: calc(50% - 10px);
        }

        @media (max-width: 768px) {
            .edit-form-columns .form-group {
                width: 100%;
            }
        }
    </style>
</head>

<body>
    <div class="header">
        <h1><i class="fas fa-building"></i> 智慧社区管理系统</h1>
    </div>
    <div class="nav">
        <ul>
            <li><a href="shoye.html"><i class="fas fa-home"></i> 首页</a></li>
            <li><a href="resident.html"><i class="fas fa-users"></i> 住户管理</a></li>
            <li><a href="property.html" class="active"><i class="fas fa-home"></i> 房产管理</a></li>
            <li><a href="repair.html"><i class="fas fa-tools"></i> 报修维护</a></li>
            <li><a href="fee.html"><i class="fas fa-money-bill-wave"></i> 费用管理</a></li>
            <li><a href="security.html"><i class="fas fa-shield-alt"></i> 社区安防</a></li>
            <li><a href="index.html"><i class="fas fa-sign-out-alt"></i> 退出登录</a></li>
        </ul>
    </div>
    <div class="container">
        <!-- 房产管理 -->
        <div id="property" class="section">
            <div class="main-content">
                <div class="sidebar">
                    <h3><i class="fas fa-home"></i> 房产管理</h3>
                    <ul class="sidebar-menu">
                        <li><a href="#property-list" class="active"><i class="fas fa-list"></i> 房产列表</a></li>
                        
                    </ul>
                </div>
                <div class="content">
                    <!-- 房产列表 -->
                    <div id="property-list" class="tab-content active">
                        <div class="card">
                            <div class="card-header">
                                <h2>房产列表</h2>
                                <button class="btn btn-primary" onclick="openAddModal()"><i class="fas fa-plus"></i> 添加房产</button>
                            </div>
                            <div class="stats-container">
                                <div class="stat-card animate-fade">
                                    <div class="stat-icon primary">
                                        <i class="fas fa-home"></i>
                                    </div>
                                    <div class="stat-info">
                                        <h3 id="total-properties">150</h3>
                                        <p>总房产数</p>
                                    </div>
                                </div>
                                <div class="stat-card animate-fade" style="animation-delay: 0.1s">
                                    <div class="stat-icon success">
                                        <i class="fas fa-check"></i>
                                    </div>
                                    <div class="stat-info">
                                        <h3 id="sold-properties">150</h3>
                                        <p>已售房产</p>
                                    </div>
                                </div>
                                <div class="stat-card animate-fade" style="animation-delay: 0.2s">
                                    <div class="stat-icon warning">
                                        <i class="fas fa-clock"></i>
                                    </div>
                                    <div class="stat-info">
                                        <h3 id="pending-properties">150</h3>
                                        <p>待售房产</p>
                                    </div>
                                </div>
                                <div class="stat-card animate-fade" style="animation-delay: 0.3s">
                                    <div class="stat-icon danger">
                                        <i class="fas fa-user"></i>
                                    </div>
                                    <div class="stat-info">
                                        <h3 id="rented-properties">150</h3>
                                        <p>出租房产</p>
                                    </div>
                                </div>
                            </div>
                            <div class="card-header" style="padding-top: 0;">
                                <div style="display: flex; justify-content: space-between; align-items: center;">
                                    <div style="display: flex; gap: 10px; flex-wrap: wrap;">
                                        <input type="text" class="form-control" placeholder="搜索房产信息" style="width: 200px;"
                                            id="search-input">
                                        <select class="form-control" style="width: 150px;" id="building-filter">
                                            <option value="">按楼栋筛选</option>
                                            <option value="1栋">1栋</option>
                                            <option value="2栋">2栋</option>
                                            <option value="3栋">3栋</option>
                                            <option value="4栋">4栋</option>
                                            <option value="5栋">5栋</option>
                                            <option value="6栋">6栋</option>
                                            <option value="7栋">7栋</option>
                                        </select>
                                        <select class="form-control" style="width: 150px;" id="layout-filter">
                                            <option value="">按户型筛选</option>
                                            <option value="一室一厅">一室一厅</option>
                                            <option value="两室一厅">两室一厅</option>
                                            <option value="两室两厅">两室两厅</option>
                                            <option value="三室一厅">三室一厅</option>
                                            <option value="三室两厅">三室两厅</option>
                                            <option value="四室两厅">四室两厅</option>
                                            <option value="复式">复式</option>
                                        </select>
                                        <select class="form-control" style="width: 150px;" id="status-filter">
                                            <option value="">按状态筛选</option>
                                            <option value="已售">已售</option>
                                            <option value="待售">待售</option>
                                            <option value="出租中">出租中</option>
                                            <option value="维修中">维修中</option>
                                            <option value="违规">违规</option>
                                        </select>
                                        <div style="display: flex; align-items: center; gap: 5px;">
                                            <span>面积:</span>
                                            <input type="number" class="form-control" placeholder="最小(㎡)" id="min-area"
                                                style="width: 80px;">
                                            <span>-</span>
                                            <input type="number" class="form-control" placeholder="最大(㎡)" id="max-area"
                                                style="width: 80px;">
                                        </div>
                                        <button class="btn btn-primary" id="apply-filters" title="应用筛选条件">
                                            <i class="fas fa-filter"></i> 筛选
                                        </button>
                                        <button class="btn btn-outline" id="clear-filters" title="重置所有筛选条件">
                                            <i class="fas fa-sync-alt"></i> 重置筛选
                                        </button>
                                    </div>

                                </div>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-hover" id="propertyTable">
                                    <thead>
                                        <tr>
                                            <th data-sort="building">楼栋号 <i class="fas fa-sort"></i></th>
                                            <th data-sort="unit">单元号 <i class="fas fa-sort"></i></th>
                                            <th data-sort="room">房间号 <i class="fas fa-sort"></i></th>
                                            <th data-sort="area">建筑面积 <i class="fas fa-sort"></i></th>
                                            <th data-sort="layout">户型 <i class="fas fa-sort"></i></th>
                                            <th data-sort="propertyStatus">产权状态 <i class="fas fa-sort"></i></th>
                                            <th data-sort="owner">业主姓名 <i class="fas fa-sort"></i></th>
                                            <th data-sort="contact">联系方式 <i class="fas fa-sort"></i></th>
                                            <th data-sort="checkinStatus">入住状态 <i class="fas fa-sort"></i></th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <!-- 这里可以动态添加房产信息 -->
                                        <tr>
                                            <td>1栋</td>
                                            <td>2单元</td>
                                            <td>101</td>
                                            <td>120㎡</td>
                                            <td>三室两厅</td>
                                            <td><span class="badge badge-success">已售</span></td>
                                            <td>张三</td>
                                            <td>13800138000</td>
                                            <td><span class="badge badge-primary">已入住</span></td>
                                           <td class="actions">
                                                <button class="btn btn-sm btn-primary" onclick="editProperty(this)">编辑</button>
                                                <button class="btn btn-sm btn-danger" onclick="deleteProperty(this)">删除</button>
                                                <button class="btn btn-sm btn-outline" onclick="viewDetails(this)">详情</button>
                                            </td>
                                        </tr>
                                             <tr>
                                            <td>1栋</td>
                                            <td>2单元</td>
                                            <td>101</td>
                                            <td>120㎡</td>
                                            <td>三室两厅</td>
                                            <td><span class="badge badge-success">已售</span></td>
                                            <td>张三</td>
                                            <td>13800138000</td>
                                            <td><span class="badge badge-primary">已入住</span></td>
                                            <td class="actions">
                                                <button class="btn btn-sm btn-primary" onclick="editProperty(this)">编辑</button>
                                                <button class="btn btn-sm btn-danger" onclick="deleteProperty(this)">删除</button>
                                                <button class="btn btn-sm btn-outline" onclick="viewDetails(this)">详情</button>
                                            </td>
                                        </tr>
                                                    <tr>
                                            <td>1栋</td>
                                            <td>2单元</td>
                                            <td>101</td>
                                            <td>120㎡</td>
                                            <td>三室两厅</td>
                                            <td><span class="badge badge-success">已售</span></td>
                                            <td>张三</td>
                                            <td>13800138000</td>
                                            <td><span class="badge badge-primary">已入住</span></td>
                                            <td class="actions">
                                                <button class="btn btn-sm btn-primary" onclick="editProperty(this)">编辑</button>
                                                <button class="btn btn-sm btn-danger" onclick="deleteProperty(this)">删除</button>
                                                <button class="btn btn-sm btn-outline" onclick="viewDetails(this)">详情</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>1栋</td>
                                            <td>2单元</td>
                                            <td>101</td>
                                            <td>120㎡</td>
                                            <td>三室两厅</td>
                                            <td><span class="badge badge-success">已售</span></td>
                                            <td>张三</td>
                                            <td>13800138000</td>
                                            <td><span class="badge badge-primary">已入住</span></td>
                                            <td class="actions">
                                                <button class="btn btn-sm btn-primary" onclick="editProperty(this)">编辑</button>
                                                <button class="btn btn-sm btn-danger" onclick="deleteProperty(this)">删除</button>
                                                <button class="btn btn-sm btn-outline" onclick="viewDetails(this)">详情</button>
                                            </td>
                                        </tr>
                                        <!-- 新增的房产信息行 -->
                                        <tr>
                                            <td>2栋</td>
                                            <td>3单元</td>
                                            <td>202</td>
                                            <td>90㎡</td>
                                            <td>两室一厅</td>
                                            <td><span class="badge badge-warning">待售</span></td>
                                            <td></td>
                                            <td></td>
                                            <td><span class="badge badge-danger">未入住</span></td>
                                            <td class="actions">
                                                <button class="btn btn-sm btn-primary" onclick="editProperty(this)">编辑</button>
                                                <button class="btn btn-sm btn-danger" onclick="deleteProperty(this)">删除</button>
                                                <button class="btn btn-sm btn-outline" onclick="viewDetails(this)">详情</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>3栋</td>
                                            <td>1单元</td>
                                            <td>303</td>
                                            <td>150㎡</td>
                                            <td>四室两厅</td>
                                            <td><span class="badge badge-success">已售</span></td>
                                            <td>李四</td>
                                            <td>13900139000</td>
                                            <td><span class="badge badge-primary">已入住</span></td>
                                            <td class="actions">
                                                <button class="btn btn-sm btn-primary" onclick="editProperty(this)">编辑</button>
                                                <button class="btn btn-sm btn-danger" onclick="deleteProperty(this)">删除</button>
                                                <button class="btn btn-sm btn-outline" onclick="viewDetails(this)">详情</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>4栋</td>
                                            <td>4单元</td>
                                            <td>404</td>
                                            <td>100㎡</td>
                                            <td>三室一厅</td>
                                            <td><span class="badge badge-primary">出租中</span></td>
                                            <td>王五</td>
                                            <td>13700137000</td>
                                            <td><span class="badge badge-warning">出租中</span></td>
                                            <td class="actions">
                                                <button class="btn btn-sm btn-primary" onclick="editProperty(this)">编辑</button>
                                                <button class="btn btn-sm btn-danger" onclick="deleteProperty(this)">删除</button>
                                                <button class="btn btn-sm btn-outline" onclick="viewDetails(this)">详情</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>5栋</td>
                                            <td>2单元</td>
                                            <td>505</td>
                                            <td>80㎡</td>
                                            <td>一室一厅</td>
                                            <td><span class="badge badge-danger">维修中</span></td>
                                            <td></td>
                                            <td></td>
                                            <td><span class="badge badge-danger">未入住</span></td>
                                            <td class="actions">
                                                <button class="btn btn-sm btn-primary" onclick="editProperty(this)">编辑</button>
                                                <button class="btn btn-sm btn-danger" onclick="deleteProperty(this)">删除</button>
                                                <button class="btn btn-sm btn-outline" onclick="viewDetails(this)">详情</button>
                                            </td>
                                        <tr>
                                            <td>6栋</td>
                                            <td>3单元</td>
                                            <td>606</td>
                                            <td>110㎡</td>
                                            <td>两室两厅</td>
                                            <td><span class="badge badge-warning">待售</span></td>
                                            <td></td>
                                            <td></td>
                                            <td><span class="badge badge-danger">未入住</span></td>
                                            <td class="actions">
                                                <button class="btn btn-sm btn-primary" onclick="editProperty(this)">编辑</button>
                                                <button class="btn btn-sm btn-danger" onclick="deleteProperty(this)">删除</button>
                                                <button class="btn btn-sm btn-outline" onclick="viewDetails(this)">详情</button>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>7栋</td>
                                            <td>1单元</td>
                                            <td>707</td>
                                            <td>130㎡</td>
                                            <td>三室两厅</td>
                                            <td><span class="badge badge-success">已售</span></td>
                                            <td>赵六</td>
                                            <td>13600136000</td>
                                            <td><span class="badge badge-primary">已入住</span></td>
                                            <td class="actions">
                                                <button class="btn btn-sm btn-primary" onclick="editProperty(this)">编辑</button>
                                                <button class="btn btn-sm btn-danger" onclick="deleteProperty(this)">删除</button>
                                                <button class="btn btn-sm btn-outline" onclick="viewDetails(this)">详情</button>
                                            </td>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                 <!-- 添加房产模态框 -->
    <div id="addModal" class="modal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h2>添加房产信息</h2>
                    <span class="close" onclick="closeAddModal()">&times;</span>
                </div>
                <form id="addForm">
                    <div class="edit-form-columns">
                        <div class="form-group">
                            <label for="add-building">楼栋号</label>
                            <input type="text" class="form-control" id="add-building" required>
                        </div>
                        <div class="form-group">
                            <label for="add-unit">单元号</label>
                            <input type="text" class="form-control" id="add-unit" required>
                        </div>
                        <div class="form-group">
                            <label for="add-room">房间号</label>
                            <input type="text" class="form-control" id="add-room" required>
                        </div>
                        <div class="form-group">
                            <label for="add-area">建筑面积</label>
                            <input type="text" class="form-control" id="add-area" required>
                        </div>
                        <div class="form-group">
                            <label for="add-layout">户型</label>
                            <select class="form-control" id="add-layout" required>
                                <option value="一室一厅">一室一厅</option>
                                <option value="两室一厅">两室一厅</option>
                                <option value="两室两厅">两室两厅</option>
                                <option value="三室一厅">三室一厅</option>
                                <option value="三室两厅">三室两厅</option>
                                <option value="四室两厅">四室两厅</option>
                                <option value="复式">复式</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="add-propertyStatus">产权状态</label>
                            <select class="form-control" id="add-propertyStatus" required>
                                <option value="已售">已售</option>
                                <option value="待售">待售</option>
                                <option value="出租中">出租中</option>
                                <option value="维修中">维修中</option>
                                <option value="违规">违规</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="add-owner">业主姓名</label>
                            <input type="text" class="form-control" id="add-owner">
                        </div>
                        <div class="form-group">
                            <label for="add-contact">联系方式</label>
                            <input type="text" class="form-control" id="add-contact">
                        </div>
                        <div class="form-group">
                            <label for="add-checkinStatus">入住状态</label>
                            <select class="form-control" id="add-checkinStatus" required>
                                <option value="已入住">已入住</option>
                                <option value="未入住">未入住</option>
                            </select>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-outline" onclick="closeAddModal()">取消</button>
                        <button type="button" class="btn btn-primary" onclick="saveAdd()">保存</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

            </div>
        </div>
    </div>
    <!-- 编辑模态框 -->
    <div id="editModal" class="modal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h2>编辑房产信息</h2>
                    <span class="close" onclick="closeEditModal()">&times;</span>
                </div>
                <form id="editForm">
                    <div class="edit-form-columns">
                        <div class="form-group">
                            <label for="edit-building">楼栋号</label>
                            <input type="text" class="form-control" id="edit-building">
                        </div>
                        <div class="form-group">
                            <label for="edit-unit">单元号</label>
                            <input type="text" class="form-control" id="edit-unit">
                        </div>
                        <div class="form-group">
                            <label for="edit-room">房间号</label>
                            <input type="text" class="form-control" id="edit-room">
                        </div>
                        <div class="form-group">
                            <label for="edit-area">建筑面积</label>
                            <input type="text" class="form-control" id="edit-area">
                        </div>
                        <div class="form-group">
                            <label for="edit-layout">户型</label>
                            <input type="text" class="form-control" id="edit-layout">
                        </div>
                        <div class="form-group">
                            <label for="edit-propertyStatus">产权状态</label>
                            <select class="form-control" id="edit-propertyStatus">
                                <option value="已售">已售</option>
                                <option value="待售">待售</option>
                                <option value="出租中">出租中</option>
                                <option value="维修中">维修中</option>
                                <option value="违规">违规</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="edit-owner">业主姓名</label>
                            <input type="text" class="form-control" id="edit-owner">
                        </div>
                        <div class="form-group">
                            <label for="edit-contact">联系方式</label>
                            <input type="text" class="form-control" id="edit-contact">
                        </div>
                        <div class="form-group">
                            <label for="edit-checkinStatus">入住状态</label>
                            <select class="form-control" id="edit-checkinStatus">
                                <option value="已入住">已入住</option>
                                <option value="未入住">未入住</option>
                            </select>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-outline" onclick="closeEditModal()">取消</button>
                        <button type="button" class="btn btn-primary" onclick="saveEdit()">保存</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!-- 详情模态框 -->
    <div id="detailModal" class="modal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">房产详情</h5>
                    <button type="button" class="close" onclick="closeDetailModal()">&times;</button>
                </div>
                <div class="modal-body">
                    <table class="table table-striped">
                        <tr><td>楼栋</td><td id="detail-building"></td></tr>
                        <tr><td>单元</td><td id="detail-unit"></td></tr>
                        <tr><td>房间</td><td id="detail-room"></td></tr>
                        <tr><td>面积</td><td id="detail-area"></td></tr>
                        <tr><td>户型</td><td id="detail-layout"></td></tr>
                        <tr><td>房产状态</td><td id="detail-propertyStatus"></td></tr>
                        <tr><td>业主</td><td id="detail-owner"></td></tr>
                        <tr><td>联系方式</td><td id="detail-contact"></td></tr>
                        <tr><td>入住状态</td><td id="detail-checkinStatus"></td></tr>
                    </table>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" onclick="closeDetailModal()">关闭</button>
                </div>
            </div>
        </div>
    </div>

    <style>
        .badge-rent { font-weight: bold; font-style: italic; background-color: #007bff; }
    </style>
    <script>
        let currentRow;

        function editProperty(button) {
            // 获取当前行
            currentRow = button.parentNode.parentNode;
            // 获取当前行的所有单元格
            const cells = currentRow.cells;
            // 填充模态框表单
            document.getElementById('edit-building').value = cells[0].textContent;
            document.getElementById('edit-unit').value = cells[1].textContent;
            document.getElementById('edit-room').value = cells[2].textContent;
            document.getElementById('edit-area').value = cells[3].textContent;
            document.getElementById('edit-layout').value = cells[4].textContent;
            document.getElementById('edit-propertyStatus').value = cells[5].querySelector('.badge').textContent;
            document.getElementById('edit-owner').value = cells[6].textContent;
            document.getElementById('edit-contact').value = cells[7].textContent;
            document.getElementById('edit-checkinStatus').value = cells[8].querySelector('.badge').textContent;
            // 显示模态框
            document.getElementById('editModal').style.display = 'block';
        }

        function closeEditModal() {
            // 隐藏模态框
            document.getElementById('editModal').style.display = 'none';
        }

        function saveEdit() {
            // 获取模态框表单的值
            const building = document.getElementById('edit-building').value;
            const unit = document.getElementById('edit-unit').value;
            const room = document.getElementById('edit-room').value;
            const area = document.getElementById('edit-area').value;
            const layout = document.getElementById('edit-layout').value;
            const propertyStatus = document.getElementById('edit-propertyStatus').value;
            const owner = document.getElementById('edit-owner').value;
            const contact = document.getElementById('edit-contact').value;
            const checkinStatus = document.getElementById('edit-checkinStatus').value;

            // 更新表格中的数据
            currentRow.cells[0].textContent = building;
            currentRow.cells[1].textContent = unit;
            currentRow.cells[2].textContent = room;
            currentRow.cells[3].textContent = area;
            currentRow.cells[4].textContent = layout;
            const propertyStatusCell = currentRow.cells[5];
            propertyStatusCell.innerHTML = `<span class="badge badge-${getBadgeClass(propertyStatus)}">${propertyStatus}</span>`;
            currentRow.cells[6].textContent = owner;
            currentRow.cells[7].textContent = contact;
            const checkinStatusCell = currentRow.cells[8];
            checkinStatusCell.innerHTML = `<span class="badge badge-${getBadgeClass(checkinStatus)}">${checkinStatus}</span>`;

            // 更新统计数据
            updatePropertyStats();
            // 隐藏模态框
            closeEditModal();
        }

        function filterProperties() {
    const searchTerm = document.getElementById('search-input').value.toLowerCase();
    const building = document.getElementById('building-filter').value;
    const layout = document.getElementById('layout-filter').value;
    const status = document.getElementById('status-filter').value;
    const minArea = document.getElementById('min-area').value;
    const maxArea = document.getElementById('max-area').value;

    const rows = document.querySelectorAll('#propertyTable tbody tr');
    rows.forEach(row => {
        const buildingText = row.cells[0].textContent.toLowerCase();
        const layoutText = row.cells[4].textContent.toLowerCase();
        const statusText = row.cells[5].textContent.toLowerCase();
        const areaText = row.cells[3].textContent;
        const area = parseFloat(areaText);
        const ownerText = row.cells[6].textContent.toLowerCase();
        const contactText = row.cells[7].textContent.toLowerCase();

        const matchesSearch = searchTerm === '' || buildingText.includes(searchTerm) || layoutText.includes(searchTerm) || ownerText.includes(searchTerm) || contactText.includes(searchTerm);
        const matchesBuilding = building === '' || buildingText.includes(building.toLowerCase());
        const matchesLayout = layout === '' || layoutText.includes(layout.toLowerCase());
        const matchesStatus = status === '' || statusText.includes(status.toLowerCase());
        const matchesMinArea = minArea === '' || area >= parseFloat(minArea);
        const matchesMaxArea = maxArea === '' || area <= parseFloat(maxArea);

        if (matchesSearch && matchesBuilding && matchesLayout && matchesStatus && matchesMinArea && matchesMaxArea) {
            row.style.display = '';
        } else {
            row.style.display = 'none';
        }
    });
    updatePropertyStats();
}

function clearFilters() {
    document.getElementById('search-input').value = '';
    document.getElementById('building-filter').value = '';
    document.getElementById('layout-filter').value = '';
    document.getElementById('status-filter').value = '';
    document.getElementById('min-area').value = '';
    document.getElementById('max-area').value = '';
    filterProperties();
}

function updatePropertyStats() {
    const rows = document.querySelectorAll('#propertyTable tbody tr');
    let total = 0;
    let sold = 0;
    let pending = 0;
    let rented = 0;

    rows.forEach(row => {
        if (row.style.display !== 'none') {
            total++;
            const statusText = row.cells[5].textContent.trim();
            switch (statusText) {
                case '已售':
                    sold++;
                    break;
                case '待售':
                    pending++;
                    break;
                case '出租中':
                    rented++;
                    break;
            }
        }
    });

    // 保持初始值为150并加上列表中的数量
    document.getElementById('total-properties').textContent = 150 + total;
    document.getElementById('sold-properties').textContent = 150 + sold;
    document.getElementById('pending-properties').textContent = 150 + pending;
    document.getElementById('rented-properties').textContent = 150 + rented;
}

// 添加筛选事件监听器
document.addEventListener('DOMContentLoaded', function() {
    document.getElementById('apply-filters').addEventListener('click', filterProperties);
    document.getElementById('clear-filters').addEventListener('click', clearFilters);
    // 初始加载时显示所有数据
    filterProperties();
        updatePropertyStats();
    });

function getBadgeClass(status) {
            switch (status) {
                case '已售':
                    return 'success';
                case '待售':
                    return 'warning';
                case '出租中':
                    return 'primary';
                case '维修中':
                    return 'danger';
                case '违规':
                    return 'danger';
                case '已入住':
                    return 'primary';
                case '未入住':
                    return 'warning';
                default:
                    return 'primary';
            }
        }

        // 删除房产信息
        function deleteProperty(button) {
            if (confirm('确定要删除这条房产信息吗？此操作不可恢复。')) {
                const row = button.closest('tr');
                row.parentNode.removeChild(row);
                updatePropertyStats(); // 删除后更新统计数据
            }
        }

        // 查看房产详情
        function viewDetails(button) {
            const row = button.closest('tr');
            const cells = row.cells;

            document.getElementById('detail-building').textContent = cells[0].textContent;
            document.getElementById('detail-unit').textContent = cells[1].textContent;
            document.getElementById('detail-room').textContent = cells[2].textContent;
            document.getElementById('detail-area').textContent = cells[3].textContent;
            document.getElementById('detail-layout').textContent = cells[4].textContent;
            document.getElementById('detail-propertyStatus').innerHTML = cells[5].innerHTML;
            document.getElementById('detail-owner').textContent = cells[6].textContent;
            document.getElementById('detail-contact').textContent = cells[7].textContent;
            document.getElementById('detail-checkinStatus').innerHTML = cells[8].innerHTML;

            document.getElementById('detailModal').style.display = 'block';
        }

        // 关闭详情模态框
        function closeDetailModal() {
            document.getElementById('detailModal').style.display = 'none';
        }
   
        // 添加房产相关函数
        function openAddModal() {
            document.getElementById('addModal').style.display = 'block';
        }

        function closeAddModal() {
            document.getElementById('addModal').style.display = 'none';
        }

        function saveAdd() {
            // 获取表单数据
            const building = document.getElementById('add-building').value;
            const unit = document.getElementById('add-unit').value;
            const room = document.getElementById('add-room').value;
            const area = document.getElementById('add-area').value;
            const layout = document.getElementById('add-layout').value;
            const propertyStatus = document.getElementById('add-propertyStatus').value;
            const owner = document.getElementById('add-owner').value;
            const contact = document.getElementById('add-contact').value;
            const checkinStatus = document.getElementById('add-checkinStatus').value;

            // 创建新行
            const table = document.getElementById('propertyTable').getElementsByTagName('tbody')[0];
            const newRow = table.insertRow();

            // 设置单元格内容
            newRow.innerHTML = `
                <td>${building}</td>
                <td>${unit}</td>
                <td>${room}</td>
                <td>${area}</td>
                <td>${layout}</td>
                <td><span class="badge badge-${getBadgeClass(propertyStatus)}">${propertyStatus}</span></td>
                <td>${owner}</td>
                <td>${contact}</td>
                <td><span class="badge badge-${getBadgeClass(checkinStatus)}">${checkinStatus}</span></td>
                <td class="actions">
                    <button class="btn btn-sm btn-primary" onclick="editProperty(this)">编辑</button>
                    <button class="btn btn-sm btn-danger" onclick="deleteProperty(this)">删除</button>
                    <button class="btn btn-sm btn-outline" onclick="viewDetails(this)">详情</button>
                </td>
            `;

            // 更新统计数据
            updatePropertyStats();
            // 关闭模态框
            closeAddModal();
            // 重置表单
            document.getElementById('addForm').reset();
        }
    </script>
</body>

</html>